<link rel="stylesheet" href="__STATIC__mobile/css/reset.css">
<link rel="stylesheet" href="__STATIC__mobile/css/regularmembers.css">
<link rel="stylesheet" href="__STATIC__mobile/css/cart.css">
<link rel="stylesheet" href="__STATIC__mobile/css/buy.css">
 <?php if(!$is_mobile){  ?>
        <style>
html,body{
    height:100%;
    width:50%;
    margin:0 auto;
}
.nav{
    position:absolute;
}
.morder_nav{
    position:absolute;
}
</style>
        <?php } ?>
<style>
.membersbox {
   padding-bottom: 0px;
}
</style>

<div style="position:relative" class="membersbox pad50">
        <a href="/mobile/withdraw/lists" style="position:absolute;top:10px;right:10px;max-width:100px;background-color: #01aaef;" 
           class="mbtn btn-primary  " >提现记录</a>

	<section class="myIntegral">
	
		<div class="Integral">
			<p>可兑换<?php echo C("YONGJIN_NAME");?></p>
			<p style="font-size: 18px;"><?php echo $memberinfo['money'];?></p>
		</div>


		<div class="getpros clearfix"></div>
		<div class="mintegral_content IntegralDetail">
			<h2>
				<span>填写信息</span>
			</h2>
		</div>
	</section>
</div>

<div class="membersbox pad50">

    <form action="/mobile/withdraw/tixian" method="post" id="form" class="">
    <div class="msettlement_goods_con">
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>真实姓名:</section>
						<section class="content-input fl">
							<input  class="text" maxlength="6" value="<?php  echo $mycard['realname'] ? $mycard['realname'] : $memberinfo['realname'];?>" name="realname" placeholder="必填，请输入真实姓名,必须为开户名">
						</section>
					</section>
				</section>
				
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>手机号码:</section>
						<section class="content-input fl">
                                                    <input id="mobile" type="tel" class="text" maxlength="18" readonly="true" value="<?php echo $memberinfo['mobile'];?>" name="mobile" placeholder="必填，收货人电话号码">
                                                        <button type="button" style="position:absolute;right:5px;width:30%;top:2px;" id="getcode" onclick="settime()" class="mbtn btn-success btn-big J_pay" >获取验证码</button>
                                                </section>
					</section>
				</section>
    
                                 <section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>验证码:</section>
						<section class="content-input fl">
							<input type="tel" class="text" maxlength="4"  name="smscode" placeholder="必填，验证码">
                                                </section>
					</section>
				</section>
				
    
                                <input type="hidden" name="code_id" id="code_id" value="">
    
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>银行名称:</section>
						<section class="content-input fl">
							
								<select name="bankname" id="bankname" class="select input new">
				                    <option value="" <?php echo ($mycard['bankname'] ? "":"selected");?> >请选择兑换银行</option>
									<?php foreach($banks as $k=>$v){ ?>
									<option value="<?php echo $v['ecom_name'];?>" <?php echo (($mycard['bankname']==$v['ecom_name']) ? "selected":"");?> ><?php echo $v['ecom_name'];?></option>
									<?php } ?>
				                </select>
						</section>
					</section>
				</section>
				<div id="bank" style="display:none">
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>开户行:</section>
						<section class="content-input fl">
							<input class="text" maxlength="30" value="<?php echo $mycard['kaihuhang'];?>"  name="kaihuhang" placeholder="必填，您的银行卡开户行">
						</section>
					</section>
				</section>
				
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>资金账号:</section>
						<section class="content-input fl">
							<input class="text" maxlength="30" value="<?php echo $mycard['bankcard'];?>"  name="bankcard" placeholder="必填，您的银行卡号/资金账号">
						</section>
					</section>
				</section>
				</div>
				
				<div id="alipay" style="display:none">
				<section class="fixinline pdl10" >
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>支付宝账号:</section>
						<section class="content-input fl">
							<input class="text" maxlength="30"   name="alipay" placeholder="必填，您的支付宝账号">
						</section>
					</section>
				</section>
				</div>
				
				
        
        		<?php if($withdraw_double>0){ ?>
					<section class="fixinline pdl10">
						<section class="textarea_content clearfix">
							<section class="content-name fl"><span style="color:red;">*</span>选择金额:</section>
							<section class="content-textarea fl">	
									<select name="atm_money" class="select input new" id="atm_money">
					                    <option value="" selected="">请选择金额</option>
					                    <?php for($i=1;$i<=$max_times;$i++){ ?>
					                        <option value="<?php echo $i*$withdraw_double;?>">¥<?php echo $i*$withdraw_double;?></option>
										<?php } ?>
					                </select>
							</section>
						</section>
					</section>
				<?php }else{ ?>
				
				<section class="fixinline pdl10">
					<section class="textarea_content clearfix">
						<section class="content-name fl"><span style="color:red;">*</span>兑换金额:</section>
						<section class="content-input fl">
							<input class="text" maxlength="30" value=""  name="atm_money" id="atm_money" placeholder="必填，请输入兑换金额">
						</section>
					</section>
				</section>
				
				<?php } ?>
			</div>
			
        	
			<div class="msettlement_goods_con">
			
				<?php if($withdraw_rate>0){?>
				<section class="post_fee pdl10">
					<section class="msettlement_tit">
					<span style="color:red;">提示: 兑换将代扣除<?php echo $withdraw_rate*100;?>%的税金<?php if($max_shouxufei>0){?>,税金<?php echo $max_shouxufei;?>封顶<?php } ?></span>
					<em class="settlement-choice fr"><i class="smallsize"></i></em>
					</section>
				</section>
				<?php } ?>
				
				<section class="post_fee pdl10">
					<section class="msettlement_tit">
					<span>姓名和当前微信需保持一致,否则无法兑换</span>
					<em class="settlement-choice fr"><i class="smallsize"></i></em>
					</section>
					<section class="msettlement_tit">
					<span>请核对以上信息,以免造成财产损失。</span>
					<em class="settlement-choice fr"><i class="smallsize"></i></em>
					</section>
				</section>       
			</div>  

			<section class="actions" style="width:80%;text-align:center;margin-left:10%;margin-top:20px;">
				<?php if($withdraw_double>0 && $memberinfo['money']<$withdraw_double){?>
					<a href="javascript:showerror('金额满<?php echo $withdraw_double;?>元后才能兑换');" class="mbtn btn-big" style="background-color:#999;">金额暂时无法兑换</a>
				<?php }else{ ?>
					<a href="javascript:AjaxFormSubmit();" class="mbtn btn-success btn-big J_pay" >申请兑换</a>
				<?php } ?>
			</section>
			
</div>


<div style="width:100%;white-space:normal;padding:20px 15px;box-sizing: border-box;margin-bottom:150px;">
    <p>
    温馨提示
</p>
<ul class=" list-paddingleft-2">
    <li>
        <p>
            1、最低提现金额10元起，24小时到账
        </p>
    </li>
    <li>
        <p>
            2、为保证到账及时，请填写真实全面信息，信息无误方可提现
        </p>
    </li>
</ul>
</div>

    

<script>
$('#bankname').change(function(){
	var bankname = $("select option:selected").val() ;
	
	switch(bankname){
		case '微信钱包':{
			$('#bank').hide();
			break;
		}
	
		default :{
			$('#bank').show();
			break;
		}
	}
});

var countdown=60; 

function settime() {

	mobilecode = document.getElementById("getcode");
	
    if (countdown == 0){ 
    	mobilecode.innerHTML="获取验证码"; 
    	mobilecode.removeAttribute("disabled");
        countdown = 60; 
        return;
    }else {
    	if(countdown == 60){
    		var mobile = $("#mobile").val();
    		if(mobile == ''){
    			showerror("请输入手机号");
    			return false;
    		}
    		if(!isMobile(mobile)){
    			showerror("请检查手机号是否正确");
    			return false;
    		}
    		
    		//发送短信
    		sres = sendSMS(mobile);
                //sres = 1;
    		if(!sres){
    			//发送失败
    			return false;
    		}
    	}
    	mobilecode.setAttribute("disabled", true); 
    	mobilecode.innerHTML="重新发送(" + countdown + ")"; 
        countdown--; 
    }
    
	setTimeout(function() { settime() },1000);
}


function sendSMS(mobile){
        
	var url = "/mobile/withdraw/sendsms?mobile="+mobile;
	var result = false;  
	$.ajax({
		url : url,
		type : 'GET',
		dataType : 'json',
		async: false, //关闭异步
		success : function(data) {

			if(data.ret == 0){
				$("#code_id").val(data.data);
				showsuccess("已发送");
				result = true;
			}else{
				showerror(data.msg);
				result = false;
			}
			
		},
       error: function() {
    	   showerror("网络错误");
    	   result = false;
       }
       
	});
	
	return result;//注意必须在ajax之外返回, 在ajax里面无法正常返回
	//http://blog.csdn.net/fairyhawk/article/details/8136986
}

</script>
<include file="Common:nav" />
